package com.visionarysoftwaresolutions



import grails.test.mixin.*
import org.junit.*

/**
 * See the API for {@link grails.test.mixin.web.ControllerUnitTestMixin} for usage instructions
 */
@TestFor(PictureController)
@Mock(Picture)
class PictureControllerTests {

    void testGetPicThatDoesntExist() {
       params.id = 1
       controller.getPic()
       assert response == "No picture found"
    }
    
    void testGetPicThatExists(){
        def imageData = [127, 125, 111]
        Picture pic = new Picture(image:imageData)
        mockDomain(Picture, [pic])
        params.id = 1
        controller.getPic()
        assert response == imageData
    }
}
